


function tmp_muscle_data(sb)

gavgdir = '/home/predatt/anatod/ISI/MEG/GAVG';
cd(gavgdir)
load subjname
load dataset

rootdir = '/home/predatt/anatod/ISI';
datadir = '/home/predatt/anatod/ISI/raw'; 

infofile = strcat(subjname{sb},'_datainfo.mat'); 
subdir = fullfile(rootdir,'MEG',subjname{sb}); 
cd(subdir);
load(infofile)
cd(datadir)
fprintf('Processing subject %s... \n', subjname{sb});

    % preprocess
        cfg = [];   
        cfg = datainfo.basicinfo;
        cfg.trl = datainfo.trl;
        cfg.continuous = 'yes';
        cfg.channel = {'MEG'};
        
        cfg.bpfilter    = 'yes';
        cfg.bpfreq      = [110 140];
        cfg.bpfiltord   =  8;
        cfg.bpfilttype  = 'but';
        cfg.rectify     = 'yes';
        cfg.boxcar      = 0.2;
        
        muscledata = ft_preprocessing(cfg);

datafile = strcat(subjname{sb},'_muscle_data.mat'); 
cd(subdir);
save(datafile,'muscledata');

datainfo.label = muscledata.label;
save(infofile,'datainfo');

clear data
        
end
